package org.jetlinks.pro.things.impl.converter;

import org.hswebframework.web.utils.ExpressionUtils;

import java.util.Map;

public class ExpressionThingMessageConverter extends AutoThingMessageConverter {

    public static final ExpressionThingMessageConverter INSTANCE = new ExpressionThingMessageConverter();

    @Override
    protected Object convert(Object value, Map<String, Object> context) {
        if (value instanceof String) {
            return ExpressionUtils.analytical(String.valueOf(value), context, "spel");
        }
        return super.convert(value, context);
    }
}
